
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.1 画个三角形 · 游戏引擎浅入浅出</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="captainchen">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="3.2 画个正方形.html" />
    
    
    <link rel="prev" href="3. 绘制简单图形.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">目录</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../前言.html">
            
                <a href="../前言.html">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../1. 游戏引擎框架介绍/1. 游戏引擎框架介绍.html">
            
                <a href="../1. 游戏引擎框架介绍/1. 游戏引擎框架介绍.html">
            
                    
                    1. 游戏引擎框架介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../1. 游戏引擎框架介绍/1.1 暗中观察unity.html">
            
                <a href="../1. 游戏引擎框架介绍/1.1 暗中观察unity.html">
            
                    
                    1.1 暗中观察unity
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="../1. 游戏引擎框架介绍/1.2 游戏引擎组成.html">
            
                <a href="../1. 游戏引擎框架介绍/1.2 游戏引擎组成.html">
            
                    
                    1.2 游戏引擎组成
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../2. Opengl开发环境搭建/2. Opengl开发环境搭建.html">
            
                <a href="../2. Opengl开发环境搭建/2. Opengl开发环境搭建.html">
            
                    
                    2. Opengl开发环境搭建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../2. Opengl开发环境搭建/2.1 Opengl到底是什么.html">
            
                <a href="../2. Opengl开发环境搭建/2.1 Opengl到底是什么.html">
            
                    
                    2.1 Opengl到底是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="../2. Opengl开发环境搭建/2.2 搭建Opengl开发环境.html">
            
                <a href="../2. Opengl开发环境搭建/2.2 搭建Opengl开发环境.html">
            
                    
                    2.2 搭建Opengl开发环境
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="3. 绘制简单图形.html">
            
                <a href="3. 绘制简单图形.html">
            
                    
                    3. 绘制简单图形
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="2.4.1" data-path="3.1 画个三角形.html">
            
                <a href="3.1 画个三角形.html">
            
                    
                    3.1 画个三角形
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="3.2 画个正方形.html">
            
                <a href="3.2 画个正方形.html">
            
                    
                    3.2 画个正方形
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="3.3 画个立方体.html">
            
                <a href="3.3 画个立方体.html">
            
                    
                    3.3 画个立方体
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../4. 着色器/4. 着色器.html">
            
                <a href="../4. 着色器/4. 着色器.html">
            
                    
                    4. 着色器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../4. 着色器/4.1 着色器是什么.html">
            
                <a href="../4. 着色器/4.1 着色器是什么.html">
            
                    
                    4.1 着色器是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="../4. 着色器/4.2 Unity Shader和OpenGL Shader.html">
            
                <a href="../4. 着色器/4.2 Unity Shader和OpenGL Shader.html">
            
                    
                    4.2 Unity Shader和OpenGL Shader
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.3" data-path="../4. 着色器/4.3 顶点着色器.html">
            
                <a href="../4. 着色器/4.3 顶点着色器.html">
            
                    
                    4.3 顶点着色器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.4" data-path="../4. 着色器/4.4 片段着色器.html">
            
                <a href="../4. 着色器/4.4 片段着色器.html">
            
                    
                    4.4 片段着色器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../5. 绘制贴图/5. 绘制贴图.html">
            
                <a href="../5. 绘制贴图/5. 绘制贴图.html">
            
                    
                    5. 绘制贴图
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../5. 绘制贴图/5.1 颜色和贴图.html">
            
                <a href="../5. 绘制贴图/5.1 颜色和贴图.html">
            
                    
                    5.1 颜色和贴图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="../5. 绘制贴图/5.2 贴图文件介绍.html">
            
                <a href="../5. 绘制贴图/5.2 贴图文件介绍.html">
            
                    
                    5.2 贴图文件介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="../5. 绘制贴图/5.3 CPU与GPU的通信方式.html">
            
                <a href="../5. 绘制贴图/5.3 CPU与GPU的通信方式.html">
            
                    
                    5.3 CPU与GPU的通信方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="../5. 绘制贴图/5.4 使用stb_image解析图片.html">
            
                <a href="../5. 绘制贴图/5.4 使用stb_image解析图片.html">
            
                    
                    5.4 使用stb_image解析图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.5" data-path="../5. 绘制贴图/5.5 绘制带贴图的立方体盒子.html">
            
                <a href="../5. 绘制贴图/5.5 绘制带贴图的立方体盒子.html">
            
                    
                    5.5 绘制带贴图的立方体盒子
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.6" data-path="../5. 绘制贴图/5.6 压缩纹理.html">
            
                <a href="../5. 绘制贴图/5.6 压缩纹理.html">
            
                    
                    5.6 压缩纹理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.7" data-path="../5. 绘制贴图/5.7 图片压缩工具.html">
            
                <a href="../5. 绘制贴图/5.7 图片压缩工具.html">
            
                    
                    5.7 图片压缩工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.8" data-path="../5. 绘制贴图/5.8 使用压缩纹理.html">
            
                <a href="../5. 绘制贴图/5.8 使用压缩纹理.html">
            
                    
                    5.8 使用压缩纹理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="../6. 索引与缓冲区对象/6. 缓冲区对象.html">
            
                <a href="../6. 索引与缓冲区对象/6. 缓冲区对象.html">
            
                    
                    6. 缓冲区对象
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.7.1" data-path="../6. 索引与缓冲区对象/6.1 顶点索引.html">
            
                <a href="../6. 索引与缓冲区对象/6.1 顶点索引.html">
            
                    
                    6.1 顶点索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.2" data-path="../6. 索引与缓冲区对象/6.2 缓冲区对象.html">
            
                <a href="../6. 索引与缓冲区对象/6.2 缓冲区对象.html">
            
                    
                    6.2 缓冲区对象
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="../7. Mesh和材质/7. Mesh和材质.html">
            
                <a href="../7. Mesh和材质/7. Mesh和材质.html">
            
                    
                    7. Mesh和材质
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.8.1" data-path="../7. Mesh和材质/7.1 导出Mesh文件.html">
            
                <a href="../7. Mesh和材质/7.1 导出Mesh文件.html">
            
                    
                    7.1 导出Mesh文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.2" data-path="../7. Mesh和材质/7.2 使用Mesh文件.html">
            
                <a href="../7. Mesh和材质/7.2 使用Mesh文件.html">
            
                    
                    7.2 使用Mesh文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.3" data-path="../7. Mesh和材质/7.3 Shader文件创建与使用.html">
            
                <a href="../7. Mesh和材质/7.3 Shader文件创建与使用.html">
            
                    
                    7.3 Shader文件创建与使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >3.1 画个三角形</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <html><head></head><body><div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#31-&#x753B;&#x4E2A;&#x4E09;&#x89D2;&#x5F62;"><b></b>3.1 &#x753B;&#x4E2A;&#x4E09;&#x89D2;&#x5F62;</a></li><ul><li><span class="title-icon "></span><a href="#1-&#x9879;&#x76EE;&#x7ED3;&#x6784;"><b></b>1. &#x9879;&#x76EE;&#x7ED3;&#x6784;</a></li><li><span class="title-icon "></span><a href="#2-&#x9876;&#x70B9;&#x6570;&#x636E;"><b></b>2. &#x9876;&#x70B9;&#x6570;&#x636E;</a></li><li><span class="title-icon "></span><a href="#3-&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;"><b></b>3. &#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;</a></li><li><span class="title-icon "></span><a href="#4&#x4E3B;&#x903B;&#x8F91;"><b></b>4.&#x4E3B;&#x903B;&#x8F91;</a></li></ul></ul></ul></div><h2 id="31-&#x753B;&#x4E2A;&#x4E09;&#x89D2;&#x5F62;"><a name="31-&#x753B;&#x4E2A;&#x4E09;&#x89D2;&#x5F62;" class="anchor-navigation-ex-anchor" href="#31-&#x753B;&#x4E2A;&#x4E09;&#x89D2;&#x5F62;"><i class="fa fa-link" aria-hidden="true"></i></a>3.1 &#x753B;&#x4E2A;&#x4E09;&#x89D2;&#x5F62;</h2>
<pre><code>CLion&#x9879;&#x76EE;&#x6587;&#x4EF6;&#x4F4D;&#x4E8E; samples\draw_polygon\draw_triangle\untitled
</code></pre><p>&#x5C31;&#x5982;&#x540C;&#x7F16;&#x7A0B;&#x8BED;&#x8A00;&#x7684;<code>hello world!</code>&#xFF0C;OpenGL&#x7684;&#x6700;&#x4F73;&#x5165;&#x95E8;&#x8303;&#x4F8B;&#x5C31;&#x662F;&#x7ED8;&#x5236;&#x4E00;&#x4E2A;&#x4E09;&#x89D2;&#x5F62;&#xFF0C;&#x8FD9;&#x4E00;&#x8282;&#x5C31;&#x6765;&#x505A;&#x8FD9;&#x4E2A;&#x3002;</p>
<h3 id="1-&#x9879;&#x76EE;&#x7ED3;&#x6784;"><a name="1-&#x9879;&#x76EE;&#x7ED3;&#x6784;" class="anchor-navigation-ex-anchor" href="#1-&#x9879;&#x76EE;&#x7ED3;&#x6784;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x9879;&#x76EE;&#x7ED3;&#x6784;</h3>
<p>&#x6253;&#x5F00;CLion&#x9879;&#x76EE;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#xFF1A;</p>
<p><a href="../../imgs/opengl_draw_polygon/draw_triangle/project_file_struct.png" data-lightbox="a32a03e5-e1fd-4f21-b33f-b782c4f15b74" data-title=""><img src="../../imgs/opengl_draw_polygon/draw_triangle/project_file_struct.png" alt=""></a></p>
<p>&#x4E3B;&#x8981;&#x4EE3;&#x7801;&#x6587;&#x4EF6;&#x6709;3&#x4E2A;&#xFF1A;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x4EE3;&#x7801;&#x6587;&#x4EF6;</th>
<th style="text-align:left"></th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">main.cpp</td>
<td style="text-align:left">&#x4E3B;&#x903B;&#x8F91;</td>
</tr>
<tr>
<td style="text-align:left">VertexData.h</td>
<td style="text-align:left">&#x9876;&#x70B9;&#x6570;&#x636E;(&#x5750;&#x6807;&#x3001;&#x989C;&#x8272;)</td>
</tr>
<tr>
<td style="text-align:left">ShaderSource.h</td>
<td style="text-align:left">Shader&#x4EE3;&#x7801;(&#x9876;&#x70B9;Shader&#x548C;&#x7247;&#x6BB5;Shader)</td>
</tr>
</tbody>
</table>
<p>depends&#x76EE;&#x5F55;&#x5B58;&#x653E;&#x4F9D;&#x8D56;&#x5E93;&#xFF0C;&#x5982;&#x4E0B;&#xFF1A;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x4F9D;&#x8D56;&#x5E93;</th>
<th style="text-align:left"></th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">glfw-3.3.3.bin.WIN64</td>
<td style="text-align:left">glfw&#x63D0;&#x4F9B;&#x5BF9;OpenGL API&#x5C01;&#x88C5;</td>
</tr>
<tr>
<td style="text-align:left">glm</td>
<td style="text-align:left">&#x6570;&#x5B66;&#x5E93;&#xFF0C;&#x63D0;&#x4F9B;Vector&#x3001;Matrix&#x7B49;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x8FD0;&#x7B97;</td>
</tr>
</tbody>
</table>
<h3 id="2-&#x9876;&#x70B9;&#x6570;&#x636E;"><a name="2-&#x9876;&#x70B9;&#x6570;&#x636E;" class="anchor-navigation-ex-anchor" href="#2-&#x9876;&#x70B9;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x9876;&#x70B9;&#x6570;&#x636E;</h3>
<p><code>VertexData.h</code> &#x4E2D;&#x5B58;&#x653E;&#x4E86;&#x4E09;&#x89D2;&#x5F62; &#x4E09;&#x4E2A;&#x9876;&#x70B9;&#x7684;&#x5750;&#x6807;&#x6570;&#x636E;&#x548C;&#x989C;&#x8272;&#x6570;&#x636E;&#x3002;</p>
<pre><code class="lang-c++"><span class="hljs-comment">//</span>
<span class="hljs-comment">// Created by captain on 2021/3/25.</span>
<span class="hljs-comment">// &#x9876;&#x70B9;&#x5750;&#x6807; &#x9876;&#x70B9;&#x989C;&#x8272;</span>
<span class="hljs-comment">//</span>

<span class="hljs-meta">#<span class="hljs-meta-keyword">ifndef</span> UNTITLED_VERTEXDATA_H</span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">define</span> UNTITLED_VERTEXDATA_H</span>

<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;glm/glm.hpp&gt;</span></span>

<span class="hljs-keyword">static</span> <span class="hljs-keyword">const</span> glm::vec3 kPositions[<span class="hljs-number">3</span>] = {
        glm::vec3{ <span class="hljs-number">-1.0</span>f, <span class="hljs-number">-1.0</span>f,<span class="hljs-number">0.0f</span>},
        glm::vec3{  <span class="hljs-number">1.0f</span>, <span class="hljs-number">-1.0</span>f,<span class="hljs-number">0.0f</span>},
        glm::vec3{   <span class="hljs-number">0.f</span>,  <span class="hljs-number">1.0f</span>,<span class="hljs-number">0.0f</span>}
};

<span class="hljs-keyword">static</span> <span class="hljs-keyword">const</span> glm::vec4 kColors[<span class="hljs-number">3</span>] = {
        glm::vec4{ <span class="hljs-number">1.f</span>, <span class="hljs-number">0.f</span>, <span class="hljs-number">0.f</span> ,<span class="hljs-number">1.f</span>},
        glm::vec4{ <span class="hljs-number">0.f</span>, <span class="hljs-number">1.f</span>, <span class="hljs-number">0.f</span> ,<span class="hljs-number">1.f</span>},
        glm::vec4{ <span class="hljs-number">0.f</span>, <span class="hljs-number">0.f</span>, <span class="hljs-number">1.f</span> ,<span class="hljs-number">1.f</span>}
};

<span class="hljs-meta">#<span class="hljs-meta-keyword">endif</span> <span class="hljs-comment">//UNTITLED_VERTEXDATA_H</span></span>
</code></pre>
<p>&#x53EF;&#x4EE5;&#x4FEE;&#x6539;<code>kPositions</code>&#x548C;<code>kColors</code>&#x6570;&#x503C;&#x67E5;&#x770B;&#x6548;&#x679C;&#x3002;</p>
<h3 id="3-&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;"><a name="3-&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;" class="anchor-navigation-ex-anchor" href="#3-&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;</h3>
<p><code>ShaderSource.h</code> &#x4E2D;&#x5B58;&#x653E;&#x4E86;&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;&#x548C;&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;&#x3002;</p>
<pre><code class="lang-c++"><span class="hljs-comment">//</span>
<span class="hljs-comment">// Created by captain on 2021/3/25.</span>
<span class="hljs-comment">//</span>

<span class="hljs-meta">#<span class="hljs-meta-keyword">ifndef</span> UNTITLED_SHADERSOURCE_H</span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">define</span> UNTITLED_SHADERSOURCE_H</span>

<span class="hljs-comment">//&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;</span>
<span class="hljs-keyword">static</span> <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span>* vertex_shader_text =
        <span class="hljs-string">&quot;#version 330\n&quot;</span>

        <span class="hljs-string">&quot;uniform mat4 u_mvp;\n&quot;</span>

        <span class="hljs-string">&quot;layout(location = 0) in  vec3 a_pos;\n&quot;</span>
        <span class="hljs-string">&quot;layout(location = 1) in  vec4 a_color;\n&quot;</span>

        <span class="hljs-string">&quot;out vec4 v_color;\n&quot;</span>

        <span class="hljs-string">&quot;void main()\n&quot;</span>
        <span class="hljs-string">&quot;{\n&quot;</span>
        <span class="hljs-string">&quot;    gl_Position = u_mvp * vec4(a_pos, 1.0);\n&quot;</span>
        <span class="hljs-string">&quot;    v_color = a_color;\n&quot;</span>
        <span class="hljs-string">&quot;}\n&quot;</span>;
<span class="hljs-comment">//&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;</span>
<span class="hljs-keyword">static</span> <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span>* fragment_shader_text =
        <span class="hljs-string">&quot;#version 330\n&quot;</span>
        <span class="hljs-string">&quot;in vec4 v_color;\n&quot;</span>
        <span class="hljs-string">&quot;layout(location = 0) out vec4 o_fragColor;\n&quot;</span>
        <span class="hljs-string">&quot;void main()\n&quot;</span>
        <span class="hljs-string">&quot;{\n&quot;</span>
        <span class="hljs-string">&quot;    o_fragColor = v_color;\n&quot;</span>
        <span class="hljs-string">&quot;}\n&quot;</span>;

<span class="hljs-meta">#<span class="hljs-meta-keyword">endif</span> <span class="hljs-comment">//UNTITLED_SHADERSOURCE_H</span></span>
</code></pre>
<p>&#x7740;&#x8272;&#x5668;&#x662F;&#x8FD0;&#x884C;&#x5728;GPU&#x4E0A;&#x7684;&#x7A0B;&#x5E8F;&#xFF0C;&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;&#x548C;&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;&#x4F5C;&#x7528;&#x4E8E;&#x6E32;&#x67D3;&#x7684;&#x4E0D;&#x540C;&#x9636;&#x6BB5;&#x3002;</p>
<p>&#x8FD9;&#x91CC;&#x51C6;&#x5907;&#x597D;&#x7740;&#x8272;&#x5668;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x7136;&#x540E;&#x8C03;&#x7528;OpenGL API&#x8FDB;&#x884C;&#x7F16;&#x8BD1;&#x3001;&#x94FE;&#x63A5;&#x3001;&#x8FD0;&#x884C;&#x3002;</p>
<p>&#x53EF;&#x4EE5;&#x4EE5; <code>lua</code> &#x811A;&#x672C;&#x4F5C;&#x4E3A;&#x53C2;&#x7167;&#xFF0C;&#x65B9;&#x4FBF;&#x7406;&#x89E3;&#x3002;</p>
<p>&#x7740;&#x8272;&#x5668;&#x5728;&#x7B2C;4&#x7AE0;&#x4F1A;&#x8BE6;&#x7EC6;&#x4ECB;&#x7ECD;&#x3002;</p>
<h3 id="4&#x4E3B;&#x903B;&#x8F91;"><a name="4&#x4E3B;&#x903B;&#x8F91;" class="anchor-navigation-ex-anchor" href="#4&#x4E3B;&#x903B;&#x8F91;"><i class="fa fa-link" aria-hidden="true"></i></a>4.&#x4E3B;&#x903B;&#x8F91;</h3>
<p><code>main.cpp</code> &#x5C31;&#x662F;&#x7A0B;&#x5E8F;&#x4E3B;&#x903B;&#x8F91;&#x3002;</p>
<p>&#x4E3B;&#x8981;&#x5206;&#x4E3A;4&#x4E2A;&#x6B65;&#x9AA4;&#x3002;</p>
<ol>
<li>OpenGL&#x521D;&#x59CB;&#x5316;&#xFF0C;&#x521B;&#x5EFA;Window&#x3002;</li>
<li>&#x521D;&#x59CB;&#x5316;&#x7740;&#x8272;&#x5668;&#x3002;</li>
<li>&#x5173;&#x8054;&#x7740;&#x8272;&#x5668;&#x53D8;&#x91CF;&#x548C;&#x9876;&#x70B9;&#x6570;&#x636E;</li>
<li>&#x4E3B;&#x5FAA;&#x73AF;</li>
</ol>
<h4 id="41-opengl&#x521D;&#x59CB;&#x5316;"><a name="41-opengl&#x521D;&#x59CB;&#x5316;" class="anchor-navigation-ex-anchor" href="#41-opengl&#x521D;&#x59CB;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>4.1 OpenGL&#x521D;&#x59CB;&#x5316;</h4>
<pre><code class="lang-c++"><span class="hljs-comment">//&#x521D;&#x59CB;&#x5316;OpenGL</span>
<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">init_opengl</span><span class="hljs-params">()</span>
</span>{
    <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x9519;&#x8BEF;&#x56DE;&#x8C03;</span>
    glfwSetErrorCallback(error_callback);

    <span class="hljs-keyword">if</span> (!glfwInit())
        <span class="hljs-built_in">exit</span>(EXIT_FAILURE);

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, <span class="hljs-number">2</span>);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, <span class="hljs-number">0</span>);

    <span class="hljs-comment">//&#x521B;&#x5EFA;&#x7A97;&#x53E3;</span>
    window = glfwCreateWindow(<span class="hljs-number">960</span>, <span class="hljs-number">640</span>, <span class="hljs-string">&quot;Simple example&quot;</span>, <span class="hljs-literal">NULL</span>, <span class="hljs-literal">NULL</span>);
    <span class="hljs-keyword">if</span> (!window)
    {
        glfwTerminate();
        <span class="hljs-built_in">exit</span>(EXIT_FAILURE);
    }

    glfwMakeContextCurrent(window);
    gladLoadGL(glfwGetProcAddress);
    glfwSwapInterval(<span class="hljs-number">1</span>);
}
</code></pre>
<p>&#x4E3B;&#x8981;&#x5C31;&#x662F;&#x521B;&#x5EFA;OpenGL&#x7A97;&#x53E3;&#xFF0C;&#x5206;&#x8FA8;&#x7387;&#x4E3A; 960x640&#xFF0C;&#x8FD9;&#x91CC;&#x53EF;&#x4EE5;&#x6539;&#x53D8;&#x7A97;&#x53E3;&#x5C3A;&#x5BF8;&#x770B;&#x4E0B;&#x6548;&#x679C;&#x3002;</p>
<p>&#x503C;&#x5F97;&#x8D5E;&#x626C;&#x7684;&#x662F;&#xFF0C;<code>glfwCreateWindow</code>&#x6307;&#x5B9A;&#x7684;&#x5BBD;&#x9AD8;&#xFF0C;&#x5C31;&#x662F;&#x5B9E;&#x9645;&#x663E;&#x793A;&#x533A;&#x57DF;&#x7684;&#x5BBD;&#x9AD8;&#xFF0C;&#x4E0D;&#x5305;&#x62EC;&#x6807;&#x9898;&#x680F;&#x3002;</p>
<p><a href="../../imgs/opengl_draw_polygon/draw_triangle/glfw_create_window_real_width_height.jpg" data-lightbox="c104937a-a0b2-4aee-bef5-c9a417cba6a2" data-title=""><img src="../../imgs/opengl_draw_polygon/draw_triangle/glfw_create_window_real_width_height.jpg" alt=""></a></p>
<h4 id="42-&#x521D;&#x59CB;&#x5316;&#x7740;&#x8272;&#x5668;"><a name="42-&#x521D;&#x59CB;&#x5316;&#x7740;&#x8272;&#x5668;" class="anchor-navigation-ex-anchor" href="#42-&#x521D;&#x59CB;&#x5316;&#x7740;&#x8272;&#x5668;"><i class="fa fa-link" aria-hidden="true"></i></a>4.2 &#x521D;&#x59CB;&#x5316;&#x7740;&#x8272;&#x5668;</h4>
<p>&#x5728;<code>ShaderSource.h</code> &#x63D0;&#x4F9B;&#x4E86;&#x7740;&#x8272;&#x5668;&#x4EE3;&#x7801;&#xFF0C;&#x65E2;&#x7136;&#x662F;&#x4EE3;&#x7801;&#x90A3;&#x4E48;&#x5C31;&#x9700;&#x8981;&#x8FDB;&#x884C;&#x7F16;&#x8BD1;&#x3001;&#x94FE;&#x63A5;&#x624D;&#x80FD;&#x8FD0;&#x884C;&#xFF0C;&#x521D;&#x59CB;&#x5316;&#x7740;&#x8272;&#x5668;&#x5C31;&#x662F;&#x505A;&#x8FD9;&#x4E2A;&#x3002;</p>
<pre><code class="lang-c++"><span class="hljs-comment">//&#x7F16;&#x8BD1;&#x3001;&#x94FE;&#x63A5;Shader</span>
<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">compile_shader</span><span class="hljs-params">()</span>
</span>{
    <span class="hljs-comment">//&#x521B;&#x5EFA;&#x9876;&#x70B9;Shader</span>
    vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    <span class="hljs-comment">//&#x6307;&#x5B9A;Shader&#x6E90;&#x7801;</span>
    glShaderSource(vertex_shader, <span class="hljs-number">1</span>, &amp;vertex_shader_text, <span class="hljs-literal">NULL</span>);
    <span class="hljs-comment">//&#x7F16;&#x8BD1;Shader</span>
    glCompileShader(vertex_shader);

    <span class="hljs-comment">//&#x521B;&#x5EFA;&#x7247;&#x6BB5;Shader</span>
    fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    <span class="hljs-comment">//&#x6307;&#x5B9A;Shader&#x6E90;&#x7801;</span>
    glShaderSource(fragment_shader, <span class="hljs-number">1</span>, &amp;fragment_shader_text, <span class="hljs-literal">NULL</span>);
    <span class="hljs-comment">//&#x7F16;&#x8BD1;Shader</span>
    glCompileShader(fragment_shader);

    <span class="hljs-comment">//&#x521B;&#x5EFA;GPU&#x7A0B;&#x5E8F;</span>
    program = glCreateProgram();
    <span class="hljs-comment">//&#x9644;&#x52A0;Shader</span>
    glAttachShader(program, vertex_shader);
    glAttachShader(program, fragment_shader);
    <span class="hljs-comment">//Link</span>
    glLinkProgram(program);
}
</code></pre>
<p>&#x8FC7;&#x4E00;&#x904D;&#xFF0C;&#x65AD;&#x70B9;&#x770B;&#x770B;&#x5C31;&#x884C;&#xFF0C;&#x4E0D;&#x8981;&#x6DF1;&#x7A76;&#x3002;</p>
<h4 id="43-&#x5173;&#x8054;&#x7740;&#x8272;&#x5668;&#x53D8;&#x91CF;&#x548C;&#x9876;&#x70B9;&#x6570;&#x636E;"><a name="43-&#x5173;&#x8054;&#x7740;&#x8272;&#x5668;&#x53D8;&#x91CF;&#x548C;&#x9876;&#x70B9;&#x6570;&#x636E;" class="anchor-navigation-ex-anchor" href="#43-&#x5173;&#x8054;&#x7740;&#x8272;&#x5668;&#x53D8;&#x91CF;&#x548C;&#x9876;&#x70B9;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a>4.3 &#x5173;&#x8054;&#x7740;&#x8272;&#x5668;&#x53D8;&#x91CF;&#x548C;&#x9876;&#x70B9;&#x6570;&#x636E;</h4>
<p>&#x521B;&#x5EFA;&#x597D;OpenGL&#x7A97;&#x53E3;&#x3001;&#x521D;&#x59CB;&#x5316;&#x7740;&#x8272;&#x5668;&#x4E4B;&#x540E;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x83B7;&#x53D6;&#x7740;&#x8272;&#x5668;&#x7684;&#x5C5E;&#x6027;ID&#xFF0C;&#x4E0E;&#x9876;&#x70B9;&#x5750;&#x6807;&#x548C;&#x989C;&#x8272;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x5173;&#x8054;&#x3002;</p>
<pre><code class="lang-c++"><span class="hljs-comment">//&#x83B7;&#x53D6;shader&#x5C5E;&#x6027;ID</span>
mvp_location = glGetUniformLocation(program, <span class="hljs-string">&quot;u_mvp&quot;</span>);
vpos_location = glGetAttribLocation(program, <span class="hljs-string">&quot;a_pos&quot;</span>);
vcol_location = glGetAttribLocation(program, <span class="hljs-string">&quot;a_color&quot;</span>);

<span class="hljs-comment">//&#x542F;&#x7528;&#x9876;&#x70B9;Shader&#x5C5E;&#x6027;(a_pos)&#xFF0C;&#x6307;&#x5B9A;&#x4E0E;&#x9876;&#x70B9;&#x5750;&#x6807;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x5173;&#x8054;</span>
glEnableVertexAttribArray(vpos_location);
glVertexAttribPointer(vpos_location, <span class="hljs-number">3</span>, GL_FLOAT, <span class="hljs-literal">false</span>, <span class="hljs-keyword">sizeof</span>(glm::vec3), kPositions);

<span class="hljs-comment">//&#x542F;&#x7528;&#x9876;&#x70B9;Shader&#x5C5E;&#x6027;(a_color)&#xFF0C;&#x6307;&#x5B9A;&#x4E0E;&#x9876;&#x70B9;&#x989C;&#x8272;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x5173;&#x8054;</span>
glEnableVertexAttribArray(vcol_location);
glVertexAttribPointer(vcol_location, <span class="hljs-number">3</span>, GL_FLOAT, <span class="hljs-literal">false</span>, <span class="hljs-keyword">sizeof</span>(glm::vec4), kColors);
</code></pre>
<p>&#x5173;&#x8054;&#x597D;&#x9876;&#x70B9;&#x6570;&#x636E;&#x540E;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x5728;&#x4E3B;&#x5FAA;&#x73AF;&#x91CC;&#xFF0C;&#x5C06;&#x9876;&#x70B9;&#x4E0A;&#x4F20;&#x7136;&#x540E;&#x6E32;&#x67D3;&#x3002;</p>
<h4 id="44-&#x8FDB;&#x5165;&#x4E3B;&#x5FAA;&#x73AF;"><a name="44-&#x8FDB;&#x5165;&#x4E3B;&#x5FAA;&#x73AF;" class="anchor-navigation-ex-anchor" href="#44-&#x8FDB;&#x5165;&#x4E3B;&#x5FAA;&#x73AF;"><i class="fa fa-link" aria-hidden="true"></i></a>4.4 &#x8FDB;&#x5165;&#x4E3B;&#x5FAA;&#x73AF;</h4>
<pre><code class="lang-c++"><span class="hljs-keyword">while</span> (!glfwWindowShouldClose(window))
{
    <span class="hljs-keyword">float</span> ratio;
    <span class="hljs-keyword">int</span> width, height;
    glm::mat4 model,view, projection, mvp;

    <span class="hljs-comment">//&#x83B7;&#x53D6;&#x753B;&#x9762;&#x5BBD;&#x9AD8;</span>
    glfwGetFramebufferSize(window, &amp;width, &amp;height);
    ratio = width / (<span class="hljs-keyword">float</span>) height;

    glViewport(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, width, height);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glClearColor(<span class="hljs-number">49.f</span>/<span class="hljs-number">255</span>,<span class="hljs-number">77.f</span>/<span class="hljs-number">255</span>,<span class="hljs-number">121.f</span>/<span class="hljs-number">255</span>,<span class="hljs-number">1.f</span>);

    <span class="hljs-comment">//&#x5750;&#x6807;&#x7CFB;&#x53D8;&#x6362;</span>
    glm::mat4 trans = glm::translate(glm::vec3(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>,<span class="hljs-number">0</span>)); <span class="hljs-comment">//&#x4E0D;&#x79FB;&#x52A8;&#x9876;&#x70B9;&#x5750;&#x6807;;</span>
    glm::mat4 rotation = glm::eulerAngleYXZ(glm::radians(<span class="hljs-number">0.f</span>), glm::radians(<span class="hljs-number">0.f</span>), glm::radians(<span class="hljs-number">0.f</span>)); <span class="hljs-comment">//&#x4F7F;&#x7528;&#x6B27;&#x62C9;&#x89D2;&#x65CB;&#x8F6C;;</span>
    glm::mat4 scale = glm::scale(glm::vec3(<span class="hljs-number">2.0f</span>, <span class="hljs-number">2.0f</span>, <span class="hljs-number">2.0f</span>)); <span class="hljs-comment">//&#x7F29;&#x653E;;</span>
    model = trans*scale*rotation;

    view = glm::lookAt(glm::vec3(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">10</span>), glm::vec3(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>,<span class="hljs-number">0</span>), glm::vec3(<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>));

    projection=glm::perspective(glm::radians(<span class="hljs-number">60.f</span>),ratio,<span class="hljs-number">1.f</span>,<span class="hljs-number">1000.f</span>);

    mvp=projection*view*model;

    <span class="hljs-comment">//&#x6307;&#x5B9A;GPU&#x7A0B;&#x5E8F;(&#x5C31;&#x662F;&#x6307;&#x5B9A;&#x9876;&#x70B9;&#x7740;&#x8272;&#x5668;&#x3001;&#x7247;&#x6BB5;&#x7740;&#x8272;&#x5668;)</span>
    glUseProgram(program);
        <span class="hljs-comment">//&#x4E0A;&#x4F20;mvp&#x77E9;&#x9635;</span>
        glUniformMatrix4fv(mvp_location, <span class="hljs-number">1</span>, GL_FALSE, &amp;mvp[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>]);
        <span class="hljs-comment">//&#x4E0A;&#x4F20;&#x9876;&#x70B9;&#x6570;&#x636E;&#x5E76;&#x8FDB;&#x884C;&#x7ED8;&#x5236;</span>
        glDrawArrays(GL_TRIANGLES, <span class="hljs-number">0</span>, <span class="hljs-number">3</span>);

    glUseProgram(<span class="hljs-number">-1</span>);

    glfwSwapBuffers(window);
    glfwPollEvents();
}
</code></pre>
<p>&#x4E3B;&#x5FAA;&#x73AF;&#x4E3B;&#x8981;&#x505A;3&#x4EF6;&#x4E8B;&#xFF1A;</p>
<ol>
<li>&#x5750;&#x6807;&#x7CFB;&#x8F6C;&#x6362;</li>
<li>&#x4E0A;&#x4F20;mvp&#x77E9;&#x9635;</li>
<li>&#x8C03;&#x7528; glDrawArrays &#x4E0A;&#x4F20;&#x9876;&#x70B9;&#x6570;&#x636E;&#x5E76;&#x8FDB;&#x884C;&#x7ED8;&#x5236;(&#x8FD9;&#x5C31;&#x662F;&#x4E00;&#x4E2A;DrawCall&#x5B8C;&#x6210;)</li>
</ol>
<p>&#x4EE3;&#x7801;&#x65AD;&#x70B9;&#x770B;&#x4E24;&#x904D;&#xFF0C;&#x5750;&#x6807;&#x7CFB;&#x53D8;&#x6362;&#x91CC;&#x9762;&#x7684;&#x79FB;&#x52A8;&#x3001;&#x65CB;&#x8F6C;&#x3001;&#x7F29;&#x653E;&#x6570;&#x503C;&#x6539;&#x6539;&#x770B;&#x770B;&#x6548;&#x679C;&#xFF0C;&#x5C31;&#x5DEE;&#x4E0D;&#x591A;&#x4E86;&#x3002; </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; captainchen all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">File Modify: 
2021-04-26 14:49:02
</span></footer></body></html>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="3. 绘制简单图形.html" class="navigation navigation-prev " aria-label="Previous page: 3. 绘制简单图形">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="3.2 画个正方形.html" class="navigation navigation-next " aria-label="Next page: 3.2 画个正方形">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.1 画个三角形","level":"2.4.1","depth":2,"next":{"title":"3.2 画个正方形","level":"2.4.2","depth":2,"path":"pages/3. 绘制简单图形/3.2 画个正方形.md","ref":"pages/3. 绘制简单图形/3.2 画个正方形.md","articles":[]},"previous":{"title":"3. 绘制简单图形","level":"2.4","depth":1,"path":"pages/3. 绘制简单图形/3. 绘制简单图形.md","ref":"pages/3. 绘制简单图形/3. 绘制简单图形.md","articles":[{"title":"3.1 画个三角形","level":"2.4.1","depth":2,"path":"pages/3. 绘制简单图形/3.1 画个三角形.md","ref":"pages/3. 绘制简单图形/3.1 画个三角形.md","articles":[]},{"title":"3.2 画个正方形","level":"2.4.2","depth":2,"path":"pages/3. 绘制简单图形/3.2 画个正方形.md","ref":"pages/3. 绘制简单图形/3.2 画个正方形.md","articles":[]},{"title":"3.3 画个立方体","level":"2.4.3","depth":2,"path":"pages/3. 绘制简单图形/3.3 画个立方体.md","ref":"pages/3. 绘制简单图形/3.3 画个立方体.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","tbfed-pagefooter","splitter","lightbox","anchor-navigation-ex","search-pro","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy captainchen","modify_format":"YYYY-MM-DD HH:mm:ss"},"livereload":{},"splitter":{},"search-pro":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"lightbox":{"jquery":true,"sameUuid":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"captainchen","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"游戏引擎浅入浅出","gitbook":"*"},"file":{"path":"pages/3. 绘制简单图形/3.1 画个三角形.md","mtime":"2021-04-26T06:49:02.733Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-04-30T15:25:09.576Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

